import axios from '../utils/axios'
module.exports = async (ctx) => {
  // 获取客户端传递过来的数据
  const input = ctx.query.input
  const city = ctx.query.city
  const {
    status,
    data: {
      top
    }
  } = await axios.get('http://cp-tools.cn/search/top', {
    params: {
      input,
      city
    }
  })
  ctx.body = {
    top: status === 200 ? top : []
  }
}
